package com.uqbar.game.scene;

import com.uqbar.game.Spacecraft;
import com.uqbar.game.components.extra.Author;
import com.uqbar.game.components.extra.BackgroundComponent;
import com.uqbar.game.components.extra.Life;
import com.uqbar.game.components.extra.Score;
import com.uqbar.game.components.extra.ScoreImage;
import com.uqbar.game.components.extra.SpreaderBar;
import com.uqbar.game.random.RandomAsteroid;
import com.uqbar.vainilla.GameScene;

public class PlayScene extends GameScene{
	
	private GameAsteroid gameAsteroid;
	private Spacecraft spacecraft;
	private Score score;
	
	public PlayScene(GameAsteroid gameAsteroid) {
		this.gameAsteroid = gameAsteroid;
		initializeResources();
	}
	
	private void initializeResources(){
		SpreaderBar spreaderBar = new SpreaderBar(this.gameAsteroid.getDisplayWidth()-150);
		BackgroundComponent background = new BackgroundComponent();
		Life life = new Life(this);
		Author name = new Author();
		ScoreImage scoreImage = new ScoreImage();
		score = new Score(this, 720, 180);
		
		this.addComponent(background);
		
		RandomAsteroid r =  new RandomAsteroid(this);
		
		r.createLevel1();
		spacecraft = new Spacecraft(r, gameAsteroid);
		
		this.addComponent(spacecraft);
		this.addComponent(spreaderBar);
		this.addComponent(life);
		this.addComponent(scoreImage);
		this.addComponent(score);
		this.addComponent(name);
		
	}

	public Score getScore() {
		return score;
	}

	public void setScore(Score score) {
		this.score = score;
	}
	
	public GameScene getCurrentScene() {
		return this;
	}
	
	public GameAsteroid getGameAsteroid() {
		return gameAsteroid;
	}
	
	public void setGameAsteroid(GameAsteroid gameAsteroid) {
		this.gameAsteroid = gameAsteroid;
	}
	
	public Spacecraft getSpacecraft() {
		return spacecraft;
	}
	
	public void setSpacecraft(Spacecraft spacecraft) {
		this.spacecraft = spacecraft;
	}

}
